cmake_minimum_required(VERSION 3.5)

SET(CMAKE_C_COMPILER "/usr/bin/gcc")
SET(CMAKE_CXX_COMPILER "/usr/bin/g++")
add_definitions(-std=c++17)

project(client)

set(MY_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libs)

set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG")

# 设置编译结果输出路径
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  -fPIC -fvisibility=default")

include_directories(./include)
include_directories(./export/cpp)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs)

# aux_source_directory(./src DIR_SRCS)
aux_source_directory(./export/cpp/attributes DIR_PB_ATTR_SRCS)
aux_source_directory(./export/cpp/service DIR_PB_SERVICE_SRCS)

set(DIR_SRCS 
src/client.cc 
src/log.cc 
src/packet_base.cc 
src/recv_helper.cc 
src/send_helper.cc
src/game_map.cc
src/game_map_mgr.cc
src/app.cc
src/player.cc)

add_executable(client ${DIR_SRCS} ${DIR_PB_ATTR_SRCS} ${DIR_PB_SERVICE_SRCS})
add_executable(recv_console src/console.cc)

# add_executable(client src/client.cc src/packet_base.cc src/log.cc src/client_helper.hpp ../proto/export/cpp/common.pb.cc)

# thread
find_package(Threads)
target_link_libraries(client ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(recv_console ${CMAKE_THREAD_LIBS_INIT})

# spdlog
include_directories(./3rd)
target_link_libraries(client spdlog)

# protobuf
include_directories(./export/cpp)
target_link_libraries(client protobuf)
